
/**
  ******************************************************************************
  * Copyright 2021 The Microbee Authors. All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  * 
  * http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * 
  * @file       fmu_pwm_group_config.h
  * @author     baiyang
  * @date       2022-5-31
  ******************************************************************************
  */

#pragma once

#ifdef __cplusplus
extern "C"{
#endif

/*----------------------------------include-----------------------------------*/
#include <stdint.h>
#include <stdbool.h>
/*-----------------------------------macro------------------------------------*/
#if 0
struct pwm_group {
        const char pwm_group_name[10];

        struct rt_device_pwm* pwm_group_dev;

        // only advanced timers can do high clocks needed for more than 400Hz
        uint8_t chan[4]; // chan number, zero based, 255 for disabled

        // PWM驱动输出是否使能标志
        // 此标志用于设置PWM输出时，避免多次调用rt_pwm_enable函数
        bool pwm_chan_enable[4];

        // below this line is not initialised by hwdef.h
        enum output_mode current_mode;

        // mask of channels that are able to be enabled
        uint16_t ch_mask;
        // mask of channels that are enabled and active
        uint16_t en_mask;

        bool pwm_started;
        uint32_t rc_frequency;
        uint32_t rc_period_ns;
};
#endif

// 宏定义按照pwm_group结构体设置
#define HAL_PWM_GROUP1 { {"pwm1"}, \
        NULL, \
        {0, 1, 2, 3}, \
        {false, false, false, false}, \
        0, \
        0, \
        0, \
        false, \
        0, \
        0, \
        }

#define HAL_PWM_GROUP2 { {"pwm4"}, \
        NULL, \
        {4, 5, 6, 7}, \
        {false, false, false, false}, \
        0, \
        0, \
        0, \
        false, \
        0, \
        0, \
        }

#define HAL_PWM_GROUPS HAL_PWM_GROUP1,HAL_PWM_GROUP2

/*----------------------------------typedef-----------------------------------*/

/*----------------------------------variable----------------------------------*/

/*-------------------------------------os-------------------------------------*/

/*----------------------------------function----------------------------------*/

/*------------------------------------test------------------------------------*/

#ifdef __cplusplus
}
#endif



